package com.yyplatform.admin.platform.schedule.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import com.yyplatform.admin.platform.schedule.model.entity.JobLogEntity;

/**
 * Created on 2024-09-14
 */
public interface JobLogRepository extends JpaRepository<JobLogEntity, Long>,
        JpaSpecificationExecutor<JobLogEntity> {
    Page<JobLogEntity> findByJobId(Long jobId, Pageable pageQueryDTO);

    @Transactional
    @Modifying
    @Query(value = "delete from sys_schedule_job_log where job_id=:jobId ", nativeQuery = true)
    void deleteByJobId(@Param("jobId") Long jobId);


}
